//
//  MCFinalTabbarViewController.m
//  TLYL
//
//  Created by miaocai on 2017/12/1.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCFinalTabbarViewController.h"
#import "MCMailNavigationController.h"
#import "UIColor+MCColor.h"
#import "UIImage+Extension.h"
#import "MCTopUpRecordViewController.h"
#import "MCWithdrawRecordViewController.h"
#import "MCZhuanMoneyViewController.h"
#import "MCMineInfoModel.h"
#import "MCThdPartyZhuanZhangViewController.h"
#import "MCThirdPartyShowInfoModel.h"
@interface MCFinalTabbarViewController ()

@end

@implementation MCFinalTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setChildViewController];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mCTMNavigationViewControllerPopBack) name:@"MCTMNavigationViewController" object:nil];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)mCTMNavigationViewControllerPopBack{
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)setChildViewController{

    
 
    MCThirdPartyShowInfoModel *thirdPartyShowInfoModel = [MCThirdPartyShowInfoModel sharedMCThirdPartyShowInfoModel];
    [self setChildViewController:[[MCTopUpRecordViewController alloc] init] title:@"充值记录" normalImage:[UIImage originalImageFromImageNamed:@"czjl"] selectedImage:[UIImage originalImageFromImageNamed:@"czjl-xz"]];
    
    [self setChildViewController:[[MCWithdrawRecordViewController alloc] init] title:@"提款记录" normalImage:[UIImage originalImageFromImageNamed:@"txjl"] selectedImage:[UIImage originalImageFromImageNamed:@"txjl-xz"]];
    

    MCMineInfoModel * mineInfoModel = [MCMineInfoModel sharedMCMineInfoModel];
    
    if (thirdPartyShowInfoModel.isZhuanZhangShow && [mineInfoModel.UserType intValue] !=1) {
            
        [self setChildViewController:[[MCThdPartyZhuanZhangViewController alloc] init] title:@"转账记录" normalImage:[UIImage originalImageFromImageNamed:@"drbzzjlwxz"] selectedImage:[UIImage originalImageFromImageNamed:@"denzzjlxz"]];
        }
    

}

- (void)setChildViewController:(UIViewController *)viewController title:(NSString *)title normalImage:
(UIImage *)image selectedImage:(UIImage *)selectedImage{
    viewController.tabBarItem.title = title;
    viewController.tabBarItem.image = image;
    viewController.tabBarItem.selectedImage = selectedImage;
    MCMailNavigationController *navi = [[MCMailNavigationController alloc] initWithRootViewController:viewController];
    [self addChildViewController:navi];
    
}

@end
